package com.example.qy160demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfig {
    // 封装了一个Docket 类 完成swagger  功能
    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("qy160")
                .select()
                //只显示 com.example.qy160demo.controller 的api
                .apis(RequestHandlerSelectors.basePackage("com.example.qy160demo.controller")).build();
    }
}
